package com.xingyu.springbootlearn.mapper;

import com.xingyu.springbootlearn.pojo.Department;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

//@Mapper : 表示本类是一个 MyBatis 的 Mapper
@Mapper
@Repository
public interface DepartmentMapper {

    // 获取所有部门信息
//    @Select("select * from department")
    List<Department> getDepartments();

    // 通过id获得部门
    @Select("select * from department where id = #{id}")
    Department getDepartment(@Param("id") Integer id);

}